package day07;

import java.io.*;

/**
 * 使用缓冲流复制myfile.txt文件为myfile_cp2.txt
 * @author Bonnie
 *
 */
public class Test02 {
    public static void main(String[] args) throws IOException {
        BufferedInputStream br = new BufferedInputStream(new FileInputStream("myfile.txt"));
        BufferedOutputStream bo = new BufferedOutputStream(new FileOutputStream("myfile_cp2.txt"));
        byte[] bs = new byte[1024];
        int len;
        while ((len=br.read(bs))!=-1){
            bo.write(bs,0,len);
        }
        br.close();
        bo.close();
    }
}
